<?php

include dirname(dirname(__FILE__)) . '/include/common.php';

class webServiceLogout extends core {

    public function process() {
        $profile_id = intval($_POST['profile_id']);

        $profile = $this->db->get_row("SELECT * FROM user_device WHERE profile_id = '{$profile_id}' LIMIT 1");

        if ($profile) {
            $this->db->query("UPDATE `user_device` SET `online` = 0 WHERE profile_id = '{$profile_id}' LIMIT 1;");
            $this->_response(0);
        } else {
            $this->_response(1);
        }
    }

}

$processor = new webServiceLogout();
$processor->process();
?>